/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package players;

import java.util.ArrayList;

/**
 *
 * @author theworldiwant
 */
public class Player {
    
    protected String type; //'A' for aggressive, 'S' for safe, 'I' for intelligent, 'R' for Random
    protected int score;
    protected int position;
    protected boolean askForThird;
    protected ArrayList<Integer> cards;
    private int scoreThreshold;
    private int place;
    
    /**
     *for safe and aggressive players 
     * /
    
     */
    /**
     * @return the type
     */
    public Player(){
        cards = new ArrayList<Integer>();
        place=-1;
    }
    
    public String getType() {
        return type;
    }

    /**
     * @param type the type to set
     */
    public void setType(String type) {
        this.type = type;
    }

    /**
     * @return the score
     */
  
    /**
     * @param score the score to set
     */
    public void setScore(int score) { 
        this.score = score;
    }

    /**
     * @return the position
     */
    public int getPosition() {
        return position;
    }

    /**
     * @param position the position to set
     */
    public void setPosition(int position) {
        this.position = position;
    }

    /**
     * @return the askForThird
     */
    public boolean isAskForThird() { 
        if(score<scoreThreshold)
            askForThird=true;
        else
            askForThird=false;
        
        return askForThird;
    }

    /**
     * @param askForThird the askForThird to set
     */
    public void setAskForThird(boolean askForThird) {
        this.askForThird = askForThird;
    }

    /**
     * @return the cards
     */
    public ArrayList<Integer> getCards() {
        return cards;
    }

    /**
     * @param cards the cards to set
     */
//    public void setCards(ArrayList<Integer> cards) {
//        this.cards = cards;
//    }
    
    public void addCard(int card){
        this.cards.add(card);
     
    }
 

    /**
     * @param scoreThreshold the scoreThreshold to set
     */
    public void setScoreThreshold(int scoreThreshold) {
        this.scoreThreshold = scoreThreshold;
    }
    

    public int getScore(){
        int score=0;
        for(int a: cards){
            score+=a;
        }
      this.score=score%10;
        return  this.score;
    }

    /**
     * @return the place
     */
    public int getPlace() {
        return place;
    }

    /**
     * @param place the place to set
     */
    public void setPlace(int place) {
        this.place = place;
    }

    public boolean getAskForThird(){
        return askForThird;
    }
 
    
}
